home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
U-Utilities
/
(c)u2.d64
/
bam.c
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-04
|
4KB
|
129 lines
100 REM BLOCK ALLOCATION MAP
110 REM WRITTEN BY TOM CONRAD
120 REM ORIGINALLY IN 'COMPUTE'
130 :
140 REM MODIFIED FOR C64
150 REM PAUL BLAIR FEBRUARY 1984
160 :
170 REM BLOCK ALLOCATION MAP (BAM)
180 REM ALLOWS YOU TO SEE WHERE YOUR
190 REM MATERIAL IS STORED ON DISK.
200 :
210 REM THE PURPOSE OF THE BAM IS TO
220 REM TO PROTECT ALLOCATED BLOCKS SO
230 REM THEY ARE NOT WRITTEN OVER AND
240 REM THEREFORE DESTROYED. THE MAP
250 REM RESIDES ON THE DIRECTORY
260 REM TRACK, (TRACK 18, SECTOR 0).
270 :
280 REM THE BAM TURNS OFF THE BITS
290 REM WHEN IT ALLOCATES A SECTOR.
300 :
310 REM THIS PGM LOOKS AT THESE BITS
320 REM & IF ON (MEANING IT IS FREE)
330 REM WILL PRINT EITHER A RED OR A
340 REM GREEN SQUARE. BY LOOKING AT
350 REM THE MAP YOU CAN DETERMINE HOW
360 REM FULL OR EMPTY THE DISK IS.
370 :
380 REM INITIALIZATION
390 :
400 DIM A(4):PP=53280:POKEPP,12:POKEPP+1,15:NL$=CHR$(0):D$="0":T=0
410 :
420 REM PRINTS THE BAM MAP OUTLINE
430 :
440 PRINT"[147] [149]TRACKS[146] 11111111112222222222333333"
450 PRINT" 12345678901234567890123456789012345"
460 PRINT"[175] [175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175]*[175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175][175]"
470 PRINT"S[146]0[167][159] [146][165]"
480 PRINT"E[146]1[167][159] [146][165]"
490 PRINT"C[146]2[170][159] [146][180]"
500 PRINT"T[146]3[170][159] [146][180]"
510 PRINT"O[146]4[170][159] [146][180]"
520 PRINT"R[146]5[170][159] [146][180]"
530 PRINT"S[146]6[170][159] [146][180]"
540 PRINT" 7[170][159] [146][180]"
550 PRINT" 8[170][159] [146][180]"
560 PRINT" 9[170][159] [146][180]"
570 PRINT"10[170][159] [146][180]"
580 PRINT"11[170][159] [146][180]"
590 PRINT"12[170][159] [146][180]"
600 PRINT"13[170][159] [146][180]"
610 PRINT"14[170][159] [146][180]"
620 PRINT"15[170][159] [146][180]"
630 PRINT"16[170][159] [146][180]"
640 PRINT"17[170][159] [146][180]"
650 PRINT"18[170][159] [146][180]"
660 PRINT"19[170][159] [146][207][183][183][183][183][183][183] [146][144]OR [144][146]=EMPTY" "
670 [153]"20+OPEN WAITSGN"
680 [153]" USRUSRUSRUSRUSRUSRUSRUSRUSRUSRUSRUSRUSRUSRUSRUSRUSR"
690 S$[178]"":T$[178]""
700 :
710 [143] INIT DRIVE AND CK FOR ERROR
720 :
730 [159] 15,8,15,"I"[170]D$:[141] 1260
740 :
750 [143] ALLOC BUFFER 0 TO CHANNEL 2
760 :
770 [159] 2,8,2,"#"[170]"0": [141] 1260
780 :
790 [143] BLOCK-READ INTO BUFFER
800 :
810 [152]15,"U1:2,"D$,18,0: [141] 1260
820 :
830 [143] SET BUFFER POINTER
840 :
850 [152]15,"B-P:2,4"
860 :
870 [143] MEMORY READ
880 :
890 [152]15,"M-R"[199](0)[199](17)
900 :
910 [143] SEARCH FOR EMPTY SECTORS
920 :
930 [129] I[178]1 [164] 35
940 :[129] L[178]1 [164] 4
950 ::[161]#2,A$
960 ::[139] A$[178]"" [167] A$[178]NL$
970 ::A(L)[178] [198](A$)
980 ::[139] L[178]1 [175] I[179][177]18 [167] T[178]T[170]A(1)
990 :[130] L
1000 :[129] J[178]2 [164] 4
1010 ::[153] " ":[139] [181](J[173]2)[178]J[173]2 [167] [153] " "
1020 ::[139] A(J)[178][198]([199](0))[167][137]1080:[143] SECT FULL
1030 ::[129] K[178]7 [164] 0 [169] [171]1
1040 :::[153] " ":[139] [181](K[173]2)[178]K[173]2 [167] [153] " "
1050 :::[139] (A(J)[171]2[174]K)[179]0 [137] 1070
1060 :::A(J)[178]A(J)[171]2[174]K:[141] 1300
1070 ::[130] K
1080 :[130] J
1090 [130] I
1100 [153]" ":[160]2:[160]15
1110 :
1120 [143] PRINTS TOTAL FREE BLOCKS
1130 :
1140 [153] [200](S$,22)[200](T$,23)"STOPFREE BLKS="T"ONONONON"
1150 [153]""[200](S$,24)[200](T$,4)"STOP'C' TO CONTINUE-'E' TO END";
1160 :
1170 [143] MAP ON SCREEN UNTIL KEY IS HIT
1180 :
1190 [161] Z$:[139] Z$[178]"" [137] 1190
1200 [139]Z$[178]"E"[167][153]"":[128]
1210 [139]Z$[178]"C"[167][138]
1220 [137]1190
1230 :
1240 [143] CHECK FOR DISK ERROR
1250 :
1260 [132]15,EN$,EM$,ET,ES: [139] EN$[178]"00" [167] [142]
1270 [153] "DISK ERROR:WAIT " EM$ " " EN$,ET "," ES
1280 [160]2:[160]15:[128]
1290 :
1300 [143] PRINT ALTERNATING PATTERN
1310 :
1320 [139] [181](I[173]2)[178] I[173]2 [175] [181](K[173]2)[178] K[173]2 [167] C$[178]" "
1330 [139] [181](I[173]2)[179][177]I[173]2 [175] [181](K[173]2)[178] K[173]2 [167] C$[178]" "
1340 [139] [181](I[173]2)[178] I[173]2 [175] [181](K[173]2)[179][177]K[173]2 [167] C$[178]" "
1350 [139] [181](I[173]2)[179][177]I[173]2 [175] [181](K[173]2)[179][177]K[173]2 [167] C$[178]" "
1360 [153] "" [200](S$,3[170]((J[171]2)[172]8)[170]K) [200](T$,2[170]I) C$
1370 [142]